home *** CD-ROM | disk | FTP | other *** search
- //: C21:Binder3.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // Binders aren't limited to producing predicates
- #include "Generators.h"
- #include <algorithm>
- #include <vector>
- #include <iostream>
- #include <functional>
- using namespace std;
-
- int main() {
- ostream_iterator<int> out(cout, " ");
- vector<int> v(15);
- generate(v.begin(), v.end(), URandGen(20));
- copy(v.begin(), v.end(), out);
- cout << endl;
- transform(v.begin(), v.end(), v.begin(),
- bind2nd(multiplies<int>(), 10));
- copy(v.begin(), v.end(), out);
- cout << endl;
- } ///:~
-